package org.gvp.manager.repository.impl;

import lombok.RequiredArgsConstructor;

import org.gvp.manager.dto.AuthorityTreeData;
import org.gvp.manager.dto.PathTreeData;
import org.gvp.manager.to.MapperUpdate;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.gvp.manager.repository.SecurityRolePathRepository;
import org.gvp.manager.mapper.SecurityRolePathMapper;
import org.gvp.manager.pojo.SecurityRolePath;
import java.util.List;
/**
 * 角色请求路径关系表 数据层接口实现类
 */
@Repository
@RequiredArgsConstructor
public class SecurityRolePathRepositoryImpl implements SecurityRolePathRepository {
    private final SecurityRolePathMapper securityRolePathMapper;


    @Override
    public List<String> searchRolePathKeys(Integer roleId) {
        return this.securityRolePathMapper.selectRolePathKeys(roleId);
    }

    @Override
    public List<PathTreeData> searchByParentId(Integer parentId) {
        return this.securityRolePathMapper.selectByParentId(parentId);
    }

    @Override
    public int logicalCancel(MapperUpdate update) {
        return this.securityRolePathMapper.logicallyDelete(update);
    }

    @Override
    public List<Integer> searchPathIds(List<String> keys) {
        return this.securityRolePathMapper.selectPathIds(keys);
    }

    @Override
    public SecurityRolePath searchByRoleIdAndPathId(Integer roleId, Integer pathId) {
        return this.securityRolePathMapper.selectByRoleIdAndPathId(roleId,pathId);
    }

    @Override
    public int append(SecurityRolePath pojo) {
        return this.securityRolePathMapper.insert(pojo);
    }

    @Override
    public int recoverCancel(Integer id) {
        return this.securityRolePathMapper.logicalRecovery(id);
    }
}
